package com.li.client.management;

import java.util.ArrayList;

import com.google.gwt.user.client.ui.FormHandler;
import com.google.gwt.user.client.ui.FormSubmitCompleteEvent;

public class DynamicCallbackFormHandlerCollection extends ArrayList<DynamicFormHandler>
{
	/**
	 * Fires a {@link FormHandler#onSubmitComplete(FormSubmitCompleteEvent)} on
	 * all handlers in the collection.
	 * 
	 * @param sender
	 *            the object sending the event
	 * @param results
	 *            the results of the form submission
	 */
	public void fireOnComplete(DynamicCallbackForm sender, String results)
	{
		DynamicFormSubmitCompleteEvent event = new DynamicFormSubmitCompleteEvent(sender, results);
		for (DynamicFormHandler handler : this)
		{
			handler.onSubmitComplete(event);
		}
	}
}
